package com.cyj.dream.admin.contacts.enums;


import com.cyj.dream.admin.util.IsEmptyUtils;

/**
 * @Description: 是否删除枚举值（物理删除）
 * @BelongsProject: Future-App
 * @BelongsPackage: com.jmcc.control.future.app.constant.enums
 * @Author: ChenYongJia
 * @CreateTime: 2020年12月21日 18:10
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
public enum IsDeleteEnum {

    /**
     * 是否删除 0:未删除 1:已删除
     **/
    DIS_DELETE(0, "未删除"),
    IS_DELETE(1, "已删除"),;

    private Integer code;
    private String message;

    IsDeleteEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 根据 类型编码 来获取路径
     * @param code
     * @return
     */
    public static String getMessByCode(Integer code) {
        if (IsEmptyUtils.isEmpty(code)) {
            return null;
        }

        for (IsDeleteEnum isDeleteEnum : values()) {
            if (isDeleteEnum.getCode().equals(code)) {
                return isDeleteEnum.getMessage();
            }
        }
        throw new RuntimeException("没有找到对应的是否删除标志");
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static void main(String[] args) {
        System.out.println(IsDeleteEnum.getMessByCode(1));
    }

}
